var mongoose = require('mongoose');
var dbSettings = require('../settings')

var db = mongoose.connection;

function connect() {

  mongoose.connect('mongodb://' + dbSettings.host + '/' + dbSettings.db);

  db.on('error', console.error.bind(console, 'connection error:'));
  db.once('open', function (callback) {
    // yay!
    console.log('connect success');
  });

}


module.exports = connect;